﻿////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// <copyright>Copyright 2008-2011 Andreas Huber Doenni</copyright>
// Distributed under the GNU General Public License version 2 (GPLv2).
// See accompanying file License.txt or copy at http://phuse.codeplex.com/license.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

namespace Phuse.Net.Nntp
{
    using System;
    using System.Diagnostics.CodeAnalysis;
    using System.IO;

    /// <summary>Represents the response to an <see cref="OverCommand"/>.</summary>
    /// <threadsafety static="true" instance="false"/>
    public sealed class OverResponse : MultilineResponse<OverResponse, OverInfo>
    {
        /// <summary>See <see cref="MultilineResponseBase{T, U}.CreateResponseLine(ArraySegment{byte}[])"/>.</summary>
        [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", Justification = "Method is not supposed to be called by external code.")]
        protected sealed override OverInfo CreateResponseLine(ArraySegment<byte>[] responseLineWords)
        {
            return new OverInfo(
                Parser<long>.Parse(responseLineWords[0], this.Encoding),
                responseLineWords[1],
                responseLineWords[2],
                responseLineWords[3],
                responseLineWords[4],
                responseLineWords[5],
                Parser<long>.Parse(responseLineWords[6], this.Encoding),
                Parser<long>.Parse(responseLineWords[7], this.Encoding));
        }

        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal OverResponse(Stream subsequentLines) : base(subsequentLines, 9, false, false)
        {
        }
    }
}
